using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

[RequireComponent(typeof(AudioSource))]
public class ButtonEvents : MonoBehaviour
{
    public Canvas pausedCanvas;
    private AudioSource audioSource;

    private void Awake() {
        audioSource = GetComponent<AudioSource>();
    }
    
    public void PauseGame()
    {
        pausedCanvas.gameObject.SetActive(true);
        Time.timeScale = 0;
    }

    public void UnpauseGame()
    {
        pausedCanvas.gameObject.SetActive(false);
        Time.timeScale = 1;
    }

    public void StartGame() 
    {
        Time.timeScale = 1;
        SceneManager.LoadScene(1);
    }

    public void BackToMenu()
    {
        SceneManager.LoadScene(0);
    }

    public void QuitGame()
    {
        Application.Quit();
    }

    public void ReStartGame()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }

    public void ClickSound()
    {
        audioSource.Play();
    }

    public void ChangeGameMode_SinglePlayer()
    {
        GameMod.GameMode = 0;
    }

    public void ChangeGameMode_MultiPlayer()
    {
        GameMod.GameMode = 1;
    }
}
